Looking at overall Log ReactionTime for the data

Before removing outliers

Summary Stats

ggplot(d, aes(ReactionTime, fill=Task)) +
  geom_density(alpha = .5)

summary(d$ReactionTime)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       2     735     913    1111    1212   42181

Long tail justifies outlier removal?

ggplot(d, aes(LogReactionTime, fill=Task)) +
  geom_density(alpha = .5)

summary(d$LogReactionTime)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6931  6.5999  6.8167  6.8731  7.1000 10.6497

ReactionTime by CorrectedAccuracy

agr = d %>%
    group_by(Task,LogReactionTime) %>%
    summarize(MeanCorrectedAccuracy = mean(CorrectedAccuracy) )
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
ggplot(agr, aes(x = MeanCorrectedAccuracy, y = LogReactionTime, fill = MeanCorrectedAccuracy)) +
  geom_boxplot(alpha = 0.7) + # Boxplot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
  facet_wrap(~Task) +
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)") +
  
  theme(legend.position = "none") # Remove legend
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

ggplot(d, aes(x = CorrectedAccuracy, y = LogReactionTime, fill = Task)) +
  geom_violin(alpha = 0.7) + # Violin plot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)")

  # theme(legend.position = "none") # Remove legend

CorrectedAccuracy

Overall CorrectedAccuracy

agr <- d %>% 
  group_by(Task) %>% 
  reframe(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)
dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") + 
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

Mean CorrectedAccuracy by Word / Task

agr <- d %>%
  group_by(Task,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

Mean CorrectedAccuracy by Word / Block Order

agr <- d %>%
  group_by(BlockOrder,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

Mean CorrectedAccuracy by participant

agr <- d %>%
  group_by(Task,ID.true) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=ID.true,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))

First Remove participants who aren’t super , aggregating over Task

length(unique(d$ID.true))
## [1] 40
inacc.parts <- d %>% 
  group_by(ID.true) %>% 
  summarise(MeanCorrectedAccuracy = mean(CorrectedAccuracy)) %>% 
  filter(MeanCorrectedAccuracy < .75)

# How many participants have accuracy < .75?
length(unique(inacc.parts$ID.true))
## [1] 8
d.inaccurate.removed <- d %>% 
  anti_join(inacc.parts, by = "ID.true")

# Sanity check
length(unique(d.inaccurate.removed$ID.true))
## [1] 32

Look at those graphs again

Overall CorrectedAccuracy

agr <- d.inaccurate.removed %>% 
  group_by(Task) %>% 
  reframe(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") + 
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

Mean CorrectedAccuracy by Word / Task

agr <- d.inaccurate.removed %>%
  group_by(Task,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Mean CorrectedAccuracy by participant

agr <- d.inaccurate.removed %>%
  group_by(Task,ID.true) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=ID.true,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))

Remove outliers

# Remove subjects with ReactionTime higher than 3x IQR
summary(d.inaccurate.removed$LogReactionTime)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   6.100   6.639   6.855   6.941   7.146   9.221
  #  Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  # 6.924   7.328   7.436   7.479   7.579  10.008 
range(d.inaccurate.removed$LogReactionTime)
## [1] 6.100319 9.220588
hist(d.inaccurate.removed$LogReactionTime, breaks=100, col="lightblue", xlab="LogReactionTime (ms)",
        main="Histogram with Normal Curve")

quantile(d.inaccurate.removed$LogReactionTime)
##       0%      25%      50%      75%     100% 
## 6.100319 6.638568 6.854882 7.145984 9.220588
IQR(d.inaccurate.removed$LogReactionTime)*3 # 0.7526289
## [1] 1.52225
cutoff.high <- quantile(d.inaccurate.removed$LogReactionTime)[4] + IQR(d.inaccurate.removed$LogReactionTime)*3 # 8.419261
cutoff.low <- quantile(d.inaccurate.removed$LogReactionTime)[2] - IQR(d.inaccurate.removed$LogReactionTime)*3# 6.5088838.419261


# remove subjects with ReactionTime higher than 3 x IQR
df.outliers.removed <- subset(d.inaccurate.removed, (d.inaccurate.removed$LogReactionTime > cutoff.low) & (d.inaccurate.removed$LogReactionTime < cutoff.high))

hist(df.outliers.removed$LogReactionTime, col="lightblue", xlab="LogReactionTime (ms)",
        main="Histogram with Normal Curve")

ReactionTime by CorrectedAccuracy

agr = df.outliers.removed %>%
    group_by(Task, LogReactionTime) %>%
    summarize(MeanCorrectedAccuracy = mean(CorrectedAccuracy))
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
ggplot(agr, aes(x = MeanCorrectedAccuracy, y = LogReactionTime, fill = MeanCorrectedAccuracy)) +
  geom_boxplot(alpha = 0.7) +  # Boxplot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
  facet_wrap(~Task) +
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)") +
  theme(legend.position = "none")  # Remove legend
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

ggplot(df.outliers.removed, aes(x = CorrectedAccuracy, y = LogReactionTime, fill = Task)) +
  geom_violin(alpha = 0.7) + # Violin plot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points 
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)")

CorrectedAccuracy

Overall CorrectedAccuracy

agr <- df.outliers.removed %>% 
  group_by(Task) %>% 
  reframe(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)
# View(agr)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") + 
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

  # theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  # guides(fill = "none")

Mean CorrectedAccuracy by Word / Task

agr <- df.outliers.removed %>%
  # filter(PennElementType == "Selector") %>% 
  # select(ID.true,Word,CorrectedAccuracy) %>% 
  group_by(Task,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  guides(fill = "none")

# View(d[(d$ID.true == c("56cc78e3ccc0e20006b82a7d")) & (d$Word == c("envy")),])

Mean CorrectedAccuracy by Word / Block Order

agr <- df.outliers.removed %>%
  group_by(BlockOrder,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

# View(d[(d$ID.true == c("56cc78e3ccc0e20006b82a7d")) & (d$Word == c("envy")),])

ReactionTime by Task

agr = df.outliers.removed %>%
    group_by(Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), 
              CILow = ci.low(ReactionTime), 
              CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, 
           YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=Task, y=MeanReactionTime,fill=Task)) + 
    geom_violin(trim=FALSE,alpha=.4) +
    geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
    guides(fill = "none")

ReactionTime by BlockOrder and Task

agr = df.outliers.removed %>%
    group_by(BlockOrder,Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), 
              CILow = ci.low(ReactionTime), 
              CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, 
           YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'BlockOrder', 'Task'. You can override
## using the `.groups` argument.
ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  facet_wrap(~BlockOrder) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=Task, y=MeanReactionTime,fill=BlockOrder)) + 
    geom_violin(trim=FALSE,alpha=.4) +
    geom_point(color = "black", size = 1.5, alpha = 0.5)  # Centered points

By Item

agr = df.outliers.removed %>%
    group_by(Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanReactionTime,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")
agr = df.outliers.removed %>%
    group_by(BlockOrder,Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'BlockOrder', 'Task'. You can override
## using the `.groups` argument.
dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  facet_wrap(~Word,ncol=5) +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

By ConcValCombo category and Task

Mean Raw ReactionTime and Effects of Word Valence/Concreteness

agr = df.outliers.removed %>%
    group_by(Task,ConcValCombo) %>%
    reframe(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)


dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=ConcValCombo)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

Mean Raw ReactionTime and Effects of Word Valence/Concreteness

agr = df.outliers.removed %>%
    group_by(BlockOrder,Task,ConcValCombo) %>%
    reframe(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)


dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  facet_wrap(~ConcValCombo) +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

Compare Remove participants who aren’t super accuracy, grouping by Task

i actually don’t think this is the right call if we want to look at within-subjects behavior

inacc.parts.group <- d %>% 
  group_by(Task,ID.true) %>% 
  summarise(MeanCorrectedAccuracy = mean(CorrectedAccuracy)) %>% 
  filter(MeanCorrectedAccuracy < .75)
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
# How many participants have accuracy < .75?
length(unique(inacc.parts.group$ID.true))
## [1] 11
d.inaccurate.removed.group <- d %>% 
  anti_join(inacc.parts.group, by = "ID.true")

# Sanity check
length(unique(d.inaccurate.removed.group$ID.true))
## [1] 29

Look at those graphs again

Overall CorrectedAccuracy

agr <- d.inaccurate.removed.group %>% 
  group_by(Task) %>% 
  reframe(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") + 
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

Mean CorrectedAccuracy by Word / Task

agr <- d.inaccurate.removed.group %>%
  group_by(Task,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Mean CorrectedAccuracy by participant

agr <- d.inaccurate.removed.group %>%
  group_by(Task,ID.true) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=ID.true,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))

Remove outliers for reacton time

# Remove subjects with ReactionTime higher than 3x IQR
summary(d.inaccurate.removed.group$LogReactionTime)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   6.100   6.637   6.849   6.934   7.130   9.221
  #  Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  # 6.924   7.328   7.436   7.479   7.579  10.008 
range(d.inaccurate.removed.group$LogReactionTime)
## [1] 6.100319 9.220588
hist(d.inaccurate.removed.group$LogReactionTime, breaks=100, col="lightblue", xlab="LogReactionTime (ms)",
        main="Histogram with Normal Curve")

quantile(d.inaccurate.removed.group$LogReactionTime)
##       0%      25%      50%      75%     100% 
## 6.100319 6.636930 6.849066 7.130299 9.220588
IQR(d.inaccurate.removed.group$LogReactionTime)*3 # 0.7526289
## [1] 1.480105
cutoff.high <- quantile(d.inaccurate.removed.group$LogReactionTime)[4] + IQR(d.inaccurate.removed.group$LogReactionTime)*3 # 8.419261
cutoff.low <- quantile(d.inaccurate.removed.group$LogReactionTime)[2] - IQR(d.inaccurate.removed.group$LogReactionTime)*3# 6.5088838.419261


# remove subjects with ReactionTime higher than 3 x IQR
df.outliers.removed.group <- subset(d.inaccurate.removed.group, (d.inaccurate.removed.group$LogReactionTime > cutoff.low) & (d.inaccurate.removed.group$LogReactionTime < cutoff.high))

hist(df.outliers.removed.group$LogReactionTime, col="lightblue", xlab="LogReactionTime (ms)",
        main="Histogram with Normal Curve")

ReactionTime by CorrectedAccuracy

agr = df.outliers.removed.group %>%
    group_by(Task,LogReactionTime) %>%
    summarize(MeanCorrectedAccuracy = mean(CorrectedAccuracy) )
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
ggplot(agr, aes(x = MeanCorrectedAccuracy, y = LogReactionTime, fill = MeanCorrectedAccuracy)) +
  geom_boxplot(alpha = 0.7) + # Boxplot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
  facet_wrap(~Task) +
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)") +

  theme(legend.position = "none") # Remove legend
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?
## The following aesthetics were dropped during statistical transformation: fill.
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

ggplot(df.outliers.removed.group, aes(x = CorrectedAccuracy, y = LogReactionTime, fill = Task)) +
  geom_violin(alpha = 0.7) + # Violin plot
  geom_jitter(position = position_jitter(0.2), color = "black", size = 1.5, alpha = 0.5) + # Add jittered points
  labs(title = "Reaction Time by CorrectedAccuracy",
       x = "CorrectedAccuracy",
       y = "Reaction Time (ms)")

  # theme(legend.position = "none") # Remove legend

CorrectedAccuracy

Overall CorrectedAccuracy

agr <- df.outliers.removed.group %>% 
  group_by(Task) %>% 
  reframe(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)
# View(agr)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") + 
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

  # theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  # guides(fill = "none")

Mean CorrectedAccuracy by Word / Task

agr <- df.outliers.removed.group %>%
  # filter(PennElementType == "Selector") %>% 
  # select(ID.true,Word,CorrectedAccuracy) %>% 
  group_by(Task,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  guides(fill = "none")

# View(d[(d$ID.true == c("56cc78e3ccc0e20006b82a7d")) & (d$Word == c("envy")),])

Mean CorrectedAccuracy by Word / Block Order

agr <- df.outliers.removed.group %>%
  group_by(BlockOrder,Word) %>% 
  mutate(MeanCorrectedAccuracy = mean(CorrectedAccuracy), 
          CILow = ci.low(CorrectedAccuracy), 
          CIHigh = ci.high(CorrectedAccuracy)) %>%
  mutate(YMin = MeanCorrectedAccuracy - CILow, 
         YMax = MeanCorrectedAccuracy + CIHigh)

dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanCorrectedAccuracy,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

# View(d[(d$ID.true == c("56cc78e3ccc0e20006b82a7d")) & (d$Word == c("envy")),])

ReactionTime by Task

agr = df.outliers.removed.group %>%
    group_by(Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), 
              CILow = ci.low(ReactionTime), 
              CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, 
           YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=Task, y=MeanReactionTime,fill=Task)) + 
    geom_violin(trim=FALSE,alpha=.4) +
    geom_point(color = "black", size = 1.5, alpha = 0.5)  # Centered points

ReactionTime by BlockOrder and Task

agr = df.outliers.removed.group %>%
    group_by(BlockOrder,Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), 
              CILow = ci.low(ReactionTime), 
              CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, 
           YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'BlockOrder', 'Task'. You can override
## using the `.groups` argument.
ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=MeanReactionTime, fill=Task)) +
  facet_wrap(~BlockOrder) +
  geom_density(alpha = .4)

ggplot(agr, aes(x=Task, y=MeanReactionTime,fill=BlockOrder)) + 
    geom_violin(trim=FALSE,alpha=.4) +
    geom_point(color = "black", size = 1.5, alpha = 0.5)

By Item

agr = df.outliers.removed.group %>%
    group_by(Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'Task'. You can override using the
## `.groups` argument.
dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Word,y=MeanReactionTime,fill=Task)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")
agr = df.outliers.removed.group %>%
    group_by(BlockOrder,Task,Word) %>%
    summarize(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)
## `summarise()` has grouped output by 'BlockOrder', 'Task'. You can override
## using the `.groups` argument.
dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  facet_wrap(~Word,ncol=5) +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9)) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

  # guides(fill = "none")

By ConcValCombo category and Task

Mean Raw ReactionTime and Effects of Word Valence/Concreteness

agr = df.outliers.removed.group %>%
    group_by(Task,ConcValCombo) %>%
    reframe(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)


dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=ConcValCombo)) +
  geom_bar(position=dodge,stat="identity") +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))

Mean Raw ReactionTime and Effects of Word Valence/Concreteness

agr = df.outliers.removed.group %>%
    group_by(BlockOrder,Task,ConcValCombo) %>%
    reframe(MeanReactionTime = mean(ReactionTime), CILow = ci.low(ReactionTime), CIHigh = ci.high(ReactionTime)) %>%
    mutate(YMin = MeanReactionTime - CILow, YMax = MeanReactionTime + CIHigh)


dodge = position_dodge(.9)
ggplot(data=agr, aes(x=Task,y=MeanReactionTime,fill=BlockOrder)) +
  geom_bar(position=dodge,stat="identity") +
  facet_wrap(~ConcValCombo) +
  geom_errorbar(aes(ymin=YMin,ymax=YMax),width=.25,position=position_dodge(0.9))